<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="alternate" href="/atom.xml" title="AiChery" type="application/atom+xml">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.5.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="基于变量的数量进行分类：  Univariate methods, variable ranking: consider the input variables (features, attributes) one by one.  Multivariate methods, variable subset selection: consider whole groups of variables">
<meta name="keywords" content="feature">
<meta property="og:type" content="article">
<meta property="og:title" content="特征选择">
<meta property="og:url" content="http:&#x2F;&#x2F;yoursite.com&#x2F;2019&#x2F;11&#x2F;07&#x2F;%E7%89%B9%E5%BE%81%E9%80%89%E6%8B%A9&#x2F;index.html">
<meta property="og:site_name" content="AiChery">
<meta property="og:description" content="基于变量的数量进行分类：  Univariate methods, variable ranking: consider the input variables (features, attributes) one by one.  Multivariate methods, variable subset selection: consider whole groups of variables">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https:&#x2F;&#x2F;res.cloudinary.com&#x2F;dyd911kmh&#x2F;image&#x2F;upload&#x2F;f_auto,q_auto:best&#x2F;v1537552825&#x2F;Image3_fqsh79.png">
<meta property="og:updated_time" content="2019-11-09T01:39:01.772Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https:&#x2F;&#x2F;res.cloudinary.com&#x2F;dyd911kmh&#x2F;image&#x2F;upload&#x2F;f_auto,q_auto:best&#x2F;v1537552825&#x2F;Image3_fqsh79.png">

<link rel="canonical" href="http://yoursite.com/2019/11/07/%E7%89%B9%E5%BE%81%E9%80%89%E6%8B%A9/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>特征选择 | AiChery</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">AiChery</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">Life is about waiting for the right moment to act.</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-简历">

    <a href="/Resume/" rel="section"><i class="fa fa-fw fa-th"></i>简历</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/11/07/%E7%89%B9%E5%BE%81%E9%80%89%E6%8B%A9/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/avatar.jpg">
      <meta itemprop="name" content="Wei Cheney">
      <meta itemprop="description" content="谦谦君子，温润如玉">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="AiChery">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          特征选择
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-11-07 12:26:25" itemprop="dateCreated datePublished" datetime="2019-11-07T12:26:25+08:00">2019-11-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-11-09 09:39:01" itemprop="dateModified" datetime="2019-11-09T09:39:01+08:00">2019-11-09</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" itemprop="url" rel="index">
                    <span itemprop="name">计算机视觉</span>
                  </a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>基于变量的数量进行分类：</p>
<ul>
<li><p>Univariate methods, variable ranking: consider the input variables (features, attributes) one by one.</p>
</li>
<li><p>Multivariate methods, variable subset selection: consider whole groups of variables together.</p>
</li>
</ul>
<p>基于在选择过程中使用的机器学习方法进行分类：</p>
<ul>
<li>过滤式（filter）: selects a subset of variables independently of the model that shall subsequently use them.</li>
<li>包裹式（wrapper）: selects a subset of variables taking into account the model that shall use them.</li>
<li>嵌入式（embedded）: the feature selection method is built in the ML model (or rather its training algorithm) itself (e.g. decision trees).</li>
</ul>
<a id="more"></a>
<h3 id="常用的filter方法"><a href="#常用的filter方法" class="headerlink" title="常用的filter方法"></a>常用的filter方法</h3><p><img src="https://res.cloudinary.com/dyd911kmh/image/upload/f_auto,q_auto:best/v1537552825/Image3_fqsh79.png" alt=""></p>
<p>过滤方法使用特定的评估标准，如距离，信息，依赖性和一致性等，对特征进行排序，从而进行进行变量选择，称之为”过滤“。过滤方法通常用作数据预处理步骤。 特征的选择独立于任何机器学习算法。 特征基于统计分数给出排名，统计分数倾向与结果变量相关的特征。</p>
<h4 id="1-F-Test-ANOVA"><a href="#1-F-Test-ANOVA" class="headerlink" title="1. F Test (ANOVA)"></a>1. F Test (ANOVA)</h4><p>Scikit-learn 提供了 <strong>Selecting K best</strong> 个特征，使用F-test.</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sklearn.feature_selection.f_regression</span><br></pre></td></tr></table></figure>
<p>对于回归问题。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sklearn.feature_selection.f_classif</span><br></pre></td></tr></table></figure>
<h4 id="2-Mutual-Information"><a href="#2-Mutual-Information" class="headerlink" title="2. Mutual Information"></a>2. Mutual Information</h4><p>F-test方法只能捕获标签与特征间的线性关系，互信息可以很好的处理非线性关系。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sklearn.feature_selection.mututal_info_regression </span><br><span class="line">sklearn.feature_selection.mututal_info_classif</span><br></pre></td></tr></table></figure>
<h3 id="常用的Wrapper方法"><a href="#常用的Wrapper方法" class="headerlink" title="常用的Wrapper方法"></a>常用的Wrapper方法</h3><p>选择一个特征子集，然后评估其建模性能。</p>
<h4 id="1-Forward-Search"><a href="#1-Forward-Search" class="headerlink" title="1. Forward Search"></a>1. Forward Search</h4><h4 id="2-Recursive-Feature-Elimination"><a href="#2-Recursive-Feature-Elimination" class="headerlink" title="2. Recursive Feature Elimination"></a>2. Recursive Feature Elimination</h4><p>Wrapper 方法通过贪婪搜索选择最好的特征集。缺点是需要训练的大量模型，计算量大。</p>
<h3 id="常用的Embedded方法"><a href="#常用的Embedded方法" class="headerlink" title="常用的Embedded方法"></a>常用的Embedded方法</h3><h4 id="1-LASSO-Linear-Regression"><a href="#1-LASSO-Linear-Regression" class="headerlink" title="1. LASSO Linear Regression"></a>1. LASSO Linear Regression</h4><h4 id="2-Tree-based-models"><a href="#2-Tree-based-models" class="headerlink" title="2. Tree based models"></a>2. Tree based models</h4><h3 id="参考资料："><a href="#参考资料：" class="headerlink" title="参考资料："></a>参考资料：</h3><p>[1] <a href="https://towardsdatascience.com/why-how-and-when-to-apply-feature-selection-e9c69adfabf2" target="_blank" rel="noopener">Why, How and When to apply Feature Selection</a></p>
<p>[2] <a href="https://www.datacamp.com/community/tutorials/feature-selection-python" target="_blank" rel="noopener">Beginner’s Guide to Feature Selection in Python</a></p>
<p>[3] <a href="https://cw.fel.cvut.cz/old/_media/courses/ae3m33ui/lectures/featureselectionshort-handouts.pdf" target="_blank" rel="noopener">Feature selection and extraction</a></p>
<p>[4] <a href="https://blog.datadive.net/selecting-good-features-part-i-univariate-selection/" target="_blank" rel="noopener">Feature selection – Part I: univariate selection</a></p>
<p>[5] <a href="https://sebastianraschka.com/faq/docs/feature_sele_categories.html" target="_blank" rel="noopener">What is the difference between filter, wrapper, and embedded methods for feature selection?</a></p>

    </div>

    
    
    
      
        <div class="reward-container">
  <div></div>
  <button disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/wechatpay.png" alt="Wei Cheney 微信支付">
        <p>微信支付</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/alipay.png" alt="Wei Cheney 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/feature/" rel="tag"># feature</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
                <a href="/2019/11/08/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89%E4%B8%AD%E7%9A%84Attention%E6%9C%BA%E5%88%B6/" rel="prev" title="计算机视觉中的Attention机制">
                  计算机视觉中的Attention机制 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          
    <div class="comments" id="gitalk-container"></div>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#常用的filter方法"><span class="nav-number">1.</span> <span class="nav-text">常用的filter方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-F-Test-ANOVA"><span class="nav-number">1.1.</span> <span class="nav-text">1. F Test (ANOVA)</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-Mutual-Information"><span class="nav-number">1.2.</span> <span class="nav-text">2. Mutual Information</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常用的Wrapper方法"><span class="nav-number">2.</span> <span class="nav-text">常用的Wrapper方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-Forward-Search"><span class="nav-number">2.1.</span> <span class="nav-text">1. Forward Search</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-Recursive-Feature-Elimination"><span class="nav-number">2.2.</span> <span class="nav-text">2. Recursive Feature Elimination</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常用的Embedded方法"><span class="nav-number">3.</span> <span class="nav-text">常用的Embedded方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-LASSO-Linear-Regression"><span class="nav-number">3.1.</span> <span class="nav-text">1. LASSO Linear Regression</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-Tree-based-models"><span class="nav-number">3.2.</span> <span class="nav-text">2. Tree based models</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#参考资料："><span class="nav-number">4.</span> <span class="nav-text">参考资料：</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <img class="site-author-image" itemprop="image" alt="Wei Cheney"
    src="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/avatar.jpg">
  <p class="site-author-name" itemprop="name">Wei Cheney</p>
  <div class="site-description" itemprop="description">谦谦君子，温润如玉</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="feed-link motion-element">
    <a href="/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/chenypic" title="GitHub &amp;rarr; https:&#x2F;&#x2F;github.com&#x2F;chenypic" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/mailto:cherycheny@gmail.com" title="E-Mail &amp;rarr; mailto:cherycheny@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/2923640394" title="Weibo &amp;rarr; https:&#x2F;&#x2F;weibo.com&#x2F;2923640394" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i>Weibo</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://twitter.com/cherycheny" title="Twitter &amp;rarr; https:&#x2F;&#x2F;twitter.com&#x2F;cherycheny" rel="noopener" target="_blank"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Wei Cheney</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.0.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.5.0
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>












        
      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>



  
















  

  

  

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">

<script>
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js', () => {
    var gitalk = new Gitalk({
      clientID: 'b518bd54c879c20706b4',
      clientSecret: 'f601dee7ed1d248ae971191226d140acbb9ca107',
      repo: 'PingLun',
      owner: 'chenypic',
      admin: ['chenypic'],
      id: '433fa753a507ff199e426334ec7cb652',
        language: '',
      distractionFreeMode: 'true'
    });
    gitalk.render('gitalk-container');
  }, window.Gitalk);
</script>

</body>
</html>
